extends Node

## 物品数据测试脚本
## 用于验证物品数据是否正确加载

func _ready():
	print("=== 物品数据测试开始 ===")
	
	# 等待一帧确保ItemManager已初始化
	await get_tree().process_frame
	
	test_problematic_items()

func test_problematic_items():
	"""测试之前有问题的物品"""
	print("\n--- 测试问题物品 ---")
	
	# 测试mithril_magic_ring_lv20
	var ring_data = ItemManager.get_equipment_by_id("mithril_magic_ring_lv20")
	if ring_data != null:
		print("✓ mithril_magic_ring_lv20 加载成功: %s (槽位: %s)" % [ring_data.name, ItemManager.EquipmentSlot.keys()[ring_data.slot]])
	else:
		print("✗ mithril_magic_ring_lv20 加载失败")
	
	# 测试refined_steel_armor_lv20
	var armor_data = ItemManager.get_equipment_by_id("refined_steel_armor_lv20")
	if armor_data != null:
		print("✓ refined_steel_armor_lv20 加载成功: %s (槽位: %s)" % [armor_data.name, ItemManager.EquipmentSlot.keys()[armor_data.slot]])
	else:
		print("✗ refined_steel_armor_lv20 加载失败")
	
	# 测试其他ARMOR槽位的装备
	var armor_items = ["steel_armor_lv20", "mithril_magic_armor_lv20", "dragon_scale_divine_armor_lv20"]
	for item_id in armor_items:
		var item_data = ItemManager.get_equipment_by_id(item_id)
		if item_data != null:
			print("✓ %s 加载成功: %s (槽位: %s)" % [item_id, item_data.name, ItemManager.EquipmentSlot.keys()[item_data.slot]])
		else:
			print("✗ %s 加载失败" % item_id)
	
	print("\n--- 测试完成 ---")
	print("总物品数量: %d" % ItemManager.item_database.size())